package com.tangyuan.user.feign;

import com.tangyuan.common.result.Result;
import com.tangyuan.feignapis.user.IUserFeignClient;
import com.tangyuan.model.User;
import com.tangyuan.model.UserBalance;
import com.tangyuan.model.UserLike;
import com.tangyuan.user.service.IUserBalanceService;
import com.tangyuan.user.service.IUserService;
import com.tangyuan.user.service.UserPublishService;
import com.tangyuan.vo.MyInfoMissionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class UserClient implements IUserFeignClient {

    @Autowired
    private IUserService userService;
    @Autowired
    private UserPublishService userPublishService;


    @PostMapping("/feignApi/user/deleteUserVideoCollectionByVideoId/{videoId}")
    @Override
    public void deleteUserVideoCollectionByVideoId(@PathVariable Long videoId) {
        userService.deleteUserVideoCollectionByVideoId(videoId);
    }

    @PostMapping("/feignApi/user/deleteUserActionByVideoId/{videoId}")
    @Override
    public void deleteUserActionByVideoId(@PathVariable Long videoId) {
        userService.deleteUserActionByVideoId(videoId);
    }


    @GetMapping("/feignApi/user/getUserById")
    @Override
    public User getUserById(@RequestParam(value = "userId") Long userId) {
        return userService.getUserById(userId);
    }

    @GetMapping("/feignApi/user/getUserListByLastSql")
    @Override
    public List<User> getUserListByLastSql(@RequestParam(value = "lastSql") String lastSql) {
        return userService.getUserListByLastSql(lastSql);
    }

    @GetMapping("/feignApi/user/saveRobotNum")
    @Override
    public Result saveRobotNum(@RequestParam(value = "param") String param) {
        return userService.saveRobotNum(param);
    }

    public Map<Long, User> getUserListById(@RequestParam(value = "userIds") List<Long> userIds) {
        return userService.getUserListById(userIds);
    }

    @Override
    public Result<MyInfoMissionVo> getMyInfoMission(Long userId) {
        return userPublishService.getMyInfoMission(userId);
    }

}
